home *** CD-ROM | disk | FTP | other *** search
/ Hackers Underworld 2: Forbidden Knowledge / Hackers Underworld 2: Forbidden Knowledge.iso / HAM / APPNOTES.003 < prev    next >
Text File  |  1990-09-02  |  7KB  |  154 lines

  1. LAN-LINK Application Notes Number 3.
  2.  
  3. By Joe Kasser G3ZCZ @ N4QQ
  4. PO Box 3419
  5. Silver Spring
  6. Md 20918
  7.  
  8.  
  9. Flow Control
  10.  
  11. This application note discuses the control of the flow of 
  12. characters between the Computer and the Terminal Node Controller 
  13. (TNC).  The method of control of the flow of characters between 
  14. the TNC and the computer is called Flow Control.  It is also used 
  15. to control the flow of characters to the computer's display.  
  16. Before looking at each of these flows, let's take a quick look at 
  17. the interface between the computer and the TNC.  
  18.  
  19. The Interface.
  20.  
  21. The interface between the computer and the TNC consists of a 
  22. cable with connectors at each end. It is commonly called an RS-
  23. 232 cable, because the signals conform to the RS-232 
  24. specification (at least they are supposed to).  The cable 
  25. contains one wire which carries data from the TNC to the 
  26. computer, one wire which carries data going the other way, and a 
  27. common or ground wire.  This is the minimum cable.  Without these 
  28. three wires, data cannot flow in both directions.  
  29.  
  30. As long as the data entering either the computer or the TNC is 
  31. coming in slower than the device can process it, there is no 
  32. problem.  However when the data comes in faster, it overflows and 
  33. characters can get lost.  For this reason, almost every program 
  34. and TNC contains a data buffer to catch and store the characters 
  35. as they come in.  This is well and good, but data still has a 
  36. habit of coming in too fast.
  37.  
  38. In order to stop the overflow from happening, flow control is 
  39. used.  This is a mechanism used between the computer and the TNC 
  40. whereby one of the devices tells the other to stop sending when 
  41. it senses that its buffer is full, and then later, when its 
  42. program has depleted the buffer, tells the other device to start 
  43. sending again.  This flow control can be used in both directions.
  44.  
  45. Hardware Flow Control
  46.  
  47. There are two types of flow control; hardware and software.  The 
  48. RS-232 cable has special wires dedicated to hardware flow 
  49. control.  Thus use of hardware flow control requires extra 
  50. conductors in the cable.  In hardware flow control a 'Clear to 
  51. Send' voltage level is placed on the wire by the receiver.  The 
  52. sender checks that level before sending any character, and only 
  53. sends characters as long as that signal is present. Should it 
  54. change state, the sender will wait until it reverts to the clear 
  55. to send state.  Since the RS-232 cable is bidirectional, there 
  56. are two such lines, one used by each device.
  57.  
  58. The 'XFLOW' parameter is used to tell the TNC which flow control 
  59. approach to use. If XFLOW is ON, then software flow control is 
  60. used, if XFLOW if OFF, hardware flow control is in effect. 
  61.  
  62. Software Flow Control
  63.  
  64. In software flow control, the signalling is done by two 
  65. characters reserved for that purpose. They are usually the 
  66. Control-S (^S) and Control-Q (^Q) characters.  When the receiver 
  67. has enough data, it sends a ^S (Stop) character to the sender who 
  68. then stops transmitting and waits for a ^Q (start) character 
  69. before continuing.  When the receiving device is ready for more 
  70. characters, it send a ^Q, and flow is restored.  
  71.  
  72. Binary Data
  73.  
  74. Software flow control has the advantage of only needing the three 
  75. wires in the cable, but has problems when binary data is being 
  76. transmitted along that interface.  The ^Q and ^S are binary 
  77. codes.  As long as only ASCII text flows along the cable, binary 
  78. codes are never seen and the ^S/^Q flow control is usable.  Once 
  79. binary characters flow, the receiving device cannot tell if a  
  80. received ^S is part of the data or is a flow control character. 
  81. Under these circumstances it stops receiving and waits for a ^Q, 
  82. which if binary data was flowing, may never come, and the program 
  83. seems to hang up. 
  84.  
  85. The original TNC software designers recognized that such a 
  86. problem might occur, and put a filter parameter in the TNC 
  87. instructions to tell the TNC to filter the received characters in 
  88. the data stream and block various characters from being passed on 
  89. to the computer.  Thus PK-232, TNC2 and MFJ1278  users could set 
  90. 'MFILTER 19' to block the ^S character from being passed to the 
  91. PK-232 if it was received while monitoring an on-the-air packet.  
  92. KAM users could use the 'FILTER ON' command to achieve the same 
  93. effect.
  94.  
  95. Flow Control in LAN-LINK
  96.  
  97. All versions of LAN-LINK upto and including 1.55 used software 
  98. flow control.  In the early days of packet radio there was little 
  99. if any binary data flowing on the LAN.  A very few stations were 
  100. using YAPP to transfer binary files.  Then along came NET/ROM 
  101. which signalled the state of the network to other nodes by means 
  102. of binary information.  Stations using LAN-LINK hung up when the 
  103. binary information contained a ^S, if they had not set their TNC 
  104. to filter out the ^S before passing the received characters to 
  105. the computer.  LAN-LINK version 1.56 and subsequent versions use 
  106. hardware flow control, hence they ignore the ^S and ^Q and don't 
  107. tend to hang up when monitoring packets containing binary data.
  108.  
  109. Display Flow Control
  110.  
  111. The TNC has the capability to echo back characters as they are 
  112. received on the RS-232 interface.  The TNC usually has this 
  113. facility switched ON when powered up.  This facility is 
  114. controlled by the 'ECHO' parameter.  When 'Echo On' is set, the 
  115. TNC echoes back on the RS-232 interface any character received on 
  116. the interface. If it is receiving characters on the radio 
  117. interface at the same time, the characters will be sent down the 
  118. RA-232 line as they are received, namely mixed together.  The 
  119. first dumb terminals and computer software used to interface the 
  120. TNC only had one screen or window to display.  To stop the 
  121. characters being typed at the keyboard from appearing on the 
  122. screen mixed together with the characters coming in from the 
  123. radio, type-in flow control is used. The type-in flow control 
  124. parameter is 'FLOW'. If FLOW is ON, any character received on 
  125. the RS-232 interface (typed at the keyboard) will stop the TNC 
  126. from sending characters on the RS-232 interface to the computer 
  127. until you type an 'Enter character'.  If you forget about the 
  128. FLOW parameter and it is ON, The TNC will not send any characters 
  129. to your screen until the TNC buffer fills up, and the system will 
  130. appear to have hung up.  These days, with LAN-LINK and two 
  131. separate windows for incoming and outgoing characters, set 'FLOW 
  132. OFF'.
  133.  
  134. Summary
  135.  
  136. To make everything work properly with both flow control and type-
  137. in flow control, make sure the following parameters are present 
  138. in your LAN-LINK.SYS file, AND THEY ARE LOADED INTO YOUR TNC.
  139.  
  140. FLOW OFF
  141. XFLOW OFF
  142. STOP 00
  143. START 00
  144. XON 00
  145. XOFF 00
  146.  
  147. 73 Joe G3ZCZ
  148.  
  149. LAN-LINK is available from the author. For an evaluation copy, 
  150. download it from Compuserve or send $5.00. On the other hand, 
  151. send $35.00 for a registered copy which will entitle you to at 
  152. least one free update.  When you write in, say where you saw this 
  153. Application Note.
  154.